package com.srzk.youthleagueback.controller;

import com.srzk.youthleagueback.pojo.*;
import com.srzk.youthleagueback.results.Result;
import com.srzk.youthleagueback.service.CommuPlatService;
import com.srzk.youthleagueback.service.LectureService;
import com.srzk.youthleagueback.service.SportService;
import com.srzk.youthleagueback.service.ThematicEducationService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/part4")
public class CommuPlatformController {

    @Autowired
    CommuPlatService service;

    @GetMapping("/commuPlatformList")
    public Result<Map<String, Object>> getList(@RequestParam("user") String user, @RequestParam("year") String year) {
        return service.getList(user, year);
    }

    @GetMapping("/commuPlatform")
    public Result<Map<String, Object>> get(@RequestParam("user") String user, @RequestParam("year") String year, @RequestParam("id") Long id) {
        return service.get(user, year, id);
    }

    @PostMapping("/commuPlatform")
    public Result<Map<String, Long>> add(CommuPlat object) {
        return service.add(object);
    }

    @DeleteMapping("/commuPlatform")
    public Result<String> delete(@RequestParam("user") String user, @RequestParam("year") String year, @RequestParam("id") Long id) {
        return service.delete(user, year, id);
    }

    @PostMapping("/commuPlatformUpdate")
    public Result<String> update(CommuPlat object) {
        return service.update(object);
    }
}
